package com.frxuexi.apps.repository

//import androidx.lifecycle.viewmodel.CreationExtras.Empty.map
import com.blankj.utilcode.util.GsonUtils
import com.frxuexi.apps.ApiService
import com.frxuexi.apps.entity.NetAppData
import com.frxuexi.lib_http.HttpType
import com.frxuexi.lib_http.NetWorkFactory
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody

class NetRepository {
    fun selClientApp(map: Map<String, Int>): Flow<NetAppData> {
        val json = GsonUtils.toJson(map)
        val body = RequestBody.create("application/json".toMediaTypeOrNull(), json)
        return NetWorkFactory.factory(HttpType.NONE).create(ApiService::class.java)
            .selClientApp(body)
    }

}